\section{Fixed Wing Flight Dynamic Model}


In this document, we cite references \cite{mueller2007introduction}.

\subsection{Propulsion}
\begin{equation}
  T_i =  T_\text{max}.\left(\frac{\rho}{\rho_\text{ref}}\right)^{n_\rho}.\left(\frac{V}{V_\text{ref}}\right)^{n_V}.\delta_{\text{th}i}
\end{equation}

\begin{equation}
  \vect{T}^{P_i}_i =  T_i.\begin{pmatrix}1\\0\\0\end{pmatrix}
\end{equation}


\begin{equation}
  \vect{T}^{B} =  \sum_i R^{P_i \rightarrow B}. \vect{T}^{P_i}_i
\end{equation}

\subsection{Aerodynamics}


{\Large{\textbf{First-Order Approximation of Applied Aero Forces \& Moments}}}\\

The aerodynamic forces and moments that are used in the linearized equations of motion are represented as a function of five parameters for longitudinal perturbed forces and moments,
and six parameters for the lateral-directional perturbed forces and moments. [Ref: T.R.YECHOUT pg:239-280]
\begin{equation*} f_{A_x} , m_A , f_{A_z} = f(u,\hat{\alpha},\dot{\alpha},q,\hat{\delta}_e)   \end{equation*} 
\begin{equation*}  l_A , f_{A_y}, n_A = f(\hat{\beta},\dot{\beta},p,r,\hat{\delta}_a,\hat{\delta}_r)  \end{equation*} 


\textbf{Nondimensionalized Longitudinal Equations for Perturbed Aero Forces \& Moments}\\
\begin{align}{\label{perturbed_lon}}
f_{A_x} = & \frac{\partial F_{A_x}}{\partial {\frac{u}{U_1}}} \left( \frac{u}{U_1} \right) + 
            \frac{\partial F_{A_x}}{\partial \hat{\alpha}} \hat{\alpha} +
            \frac{\partial F_{A_x}}{\partial {\frac{\dot{\alpha} \bar{c}}{2U_1}}} \left( \frac{\dot{\alpha} \bar{c}}{2U_1}  \right) +
            \frac{\partial F_{A_x}}{\partial {\frac{q \bar{c}}{2U_1}}} \left( \frac{q \bar{c}}{2U_1}  \right) +
            \frac{\partial F_{A_x}}{\partial \hat{\delta}_e} \hat{\delta}_e \nonumber \\[0.5em]
m_{A}   = & \frac{\partial M_{A}}{\partial {\frac{u}{U_1}}} \left( \frac{u}{U_1} \right) + 
            \frac{\partial M_{A}}{\partial \hat{\alpha}} \hat{\alpha} +
            \frac{\partial M_{A}}{\partial {\frac{\dot{\alpha} \bar{c}}{2U_1}}} \left( \frac{\dot{\alpha} \bar{c}}{2U_1}  \right) +
            \frac{\partial M_{A}}{\partial {\frac{q \bar{c}}{2U_1}}} \left( \frac{q \bar{c}}{2U_1}  \right) +
            \frac{\partial M_{A}}{\partial \hat{\delta}_e} \hat{\delta}_e \\[0.5em]
f_{A_z} = & \frac{\partial F_{A_z}}{\partial {\frac{u}{U_1}}} \left( \frac{u}{U_1} \right) + 
            \frac{\partial F_{A_z}}{\partial \hat{\alpha}} \hat{\alpha} +
            \frac{\partial F_{A_z}}{\partial {\frac{\dot{\alpha} \bar{c}}{2U_1}}} \left( \frac{\dot{\alpha} \bar{c}}{2U_1}  \right) +
            \frac{\partial F_{A_z}}{\partial {\frac{q \bar{c}}{2U_1}}} \left( \frac{q \bar{c}}{2U_1}  \right) +
            \frac{\partial F_{A_z}}{\partial \hat{\delta}_e} \hat{\delta}_e \nonumber
\end{align}


\textbf{Nondimensionalized Lateral-Directional Equations for Perturbed Aero Forces \& Moments}\\
\begin{align}{\label{perturbed_lat}}
l_{A} = & \frac{\partial L_{A}}{\partial \beta} \beta + 
            \frac{\partial L_{A}}{\partial {\frac{\dot{\beta} b}{2U_1}}} \left( \frac{\dot{\beta} b}{2U_1}  \right) +
            \frac{\partial L_{A}}{\partial {\frac{pb}{2U_1}}} \left( \frac{pb}{2U_1}  \right) +
            \frac{\partial L_{A}}{\partial {\frac{rb}{2U_1}}} \left( \frac{rb}{2U_1}  \right) +
            \frac{\partial L_{A}}{\partial \hat{\delta}_a} \hat{\delta}_a +
            \frac{\partial L_{A}}{\partial \hat{\delta}_r} \hat{\delta}_r \nonumber \\[0.5em]
f_{A_y} = & \frac{\partial F_{A_y}}{\partial \beta} \beta + 
            \frac{\partial F_{A_y}}{\partial {\frac{\dot{\beta} b}{2U_1}}} \left( \frac{\dot{\beta} b}{2U_1}  \right) +
            \frac{\partial F_{A_y}}{\partial {\frac{pb}{2U_1}}} \left( \frac{pb}{2U_1}  \right) +
            \frac{\partial F_{A_y}}{\partial {\frac{rb}{2U_1}}} \left( \frac{rb}{2U_1}  \right) +
            \frac{\partial F_{A_y}}{\partial \hat{\delta}_a} \hat{\delta}_a +
            \frac{\partial F_{A_y}}{\partial \hat{\delta}_r} \hat{\delta}_r \\[0.5em]
n_{A}   = & \frac{\partial N_{A}}{\partial \beta} \beta + 
            \frac{\partial N_{A}}{\partial {\frac{\dot{\beta} b}{2U_1}}} \left( \frac{\dot{\beta} b}{2U_1}  \right) +
            \frac{\partial N_{A}}{\partial {\frac{pb}{2U_1}}} \left( \frac{pb}{2U_1}  \right) +
            \frac{\partial N_{A}}{\partial {\frac{rb}{2U_1}}} \left( \frac{rb}{2U_1}  \right) +
            \frac{\partial N_{A}}{\partial \hat{\delta}_a} \hat{\delta}_a +
            \frac{\partial N_{A}}{\partial \hat{\delta}_r} \hat{\delta}_r \nonumber
\end{align}

\textbf{In Most Common ``AERO'' Form }\\
\vskip -0.5cm
\begin{equation}{\label{aero_perturbed_lon}}
\begin{bmatrix}
\frac{f_{A_{x}}}{\bar{q}_1\,S}\\[0.7em]
\frac{m_A}{\bar{q}_1 \,S\,\bar{c}} \\[0.7em]
\frac{f_{A_{z}}}{\bar{q}_1 \, S}
\end{bmatrix}
=\,
\begin{bmatrix}
-(C_{D_u}+2C_{D_1}) & -(C_{D_{\hat{\alpha}}} + C_{L_1}) & C_{D_{\dot{\alpha}}} & -C_{D_q} & -C_{D_{\hat{\delta}_e}}\\[0.4em]
(C_{m_{u}} + 2C_{m_{1}}) & C_{m_{\hat{\alpha}}} & C_{m_{\dot{\alpha}}} & C_{m_{q}} & C_{m_{\hat{\delta}_e}}\\[0.4em]
-(C_{L_u}+2C_{L_1}) & -(C_{L_{\hat{\alpha}}} + C_{D_1}) & C_{L_{\dot{\alpha}}} & -C_{L_q} & -C_{L_{\hat{\delta}_e}}
\end{bmatrix}
\,
\begin{bmatrix}
\frac{u}{U_1}\\[0.4em]
\hat{\alpha} \\[0.4em]
\frac{\dot{\alpha}\bar{c}}{2U_1} \\[0.4em]
\frac{q\bar{c}}{2U_1} \\[0.4em]
\hat{\delta_e}
\end{bmatrix}
\end{equation} 


\begin{equation}{\label{aero_perturbed_lat}}
\begin{bmatrix}
\frac{l_A}{\bar{q}_1 \,S\,b} \\[0.7em]
\frac{f_{A_{y}}}{\bar{q}_1 \, S}\\[0.7em]
\frac{n_A}{\bar{q}_1 \,S\,b} 
\end{bmatrix}
=\,
\begin{bmatrix}
C_{l_{\beta}} & C_{l_{\dot{\beta}}} & C_{l_{p}} & C_{l_{r}} & C_{l_{\delta_{a}}} & C_{l_{\delta_{r}}} \\[0.4em]
C_{y_{\beta}} & C_{y_{\dot{\beta}}} & C_{y_{p}} & C_{l_{r}} & C_{y_{\delta_{a}}} & C_{y_{\delta_{r}}} \\[0.4em]
C_{n_{\beta}} & C_{n_{\dot{\beta}}} & C_{n_{p}} & C_{l_{r}} & C_{n_{\delta_{a}}} & C_{n_{\delta_{r}}}
\end{bmatrix}
\,
\begin{bmatrix}
\dot{\beta}\\[0.4em]
\frac{\dot{\beta}b}{2U_1} \\[0.4em]
\frac{pb}{2U_1} \\[0.4em]
\frac{rb}{2U_1} \\[0.4em]
\delta_a \\[0.4em]
\delta_r
\end{bmatrix}
\end{equation}

The advantage of Eq. (\ref{aero_perturbed_lon} and \ref{aero_perturbed_lat}) over Eq. (\ref{perturbed_lon} and \ref{perturbed_lat}) is that the perturbed forces and moments are expressed in more common ``aero'' derivatives which can be 
estimated with analytical, numerical or experimental techniques. Recall that each derivative in Eq. (\ref{perturbed_lon} and \ref{perturbed_lat}) is dimensionless, for example, $C_{n_{p}}$ is the 
abbreviated form of $\partial C_n / \partial (pb/2U_1)$.







\subsubsection{Aerodynamic forces in wind frame}
\begin{equation}
  \vect{F}_{\text{aero}}^{W} = \frac{1}{2}.\rho.V^2.S_\text{ref}\begin{pmatrix}-C_D\\C_Y\\-C_L\end{pmatrix}
\end{equation}

with

\begin{align}
C_L &= C_{L0} + C_{L\alpha}(\alpha - \alpha_0) + C_{L\beta}.\beta + \sum_{i=p,q,r} C_{Li}.i + \sum_{\text{sfc}} C_{L\text{sfc}}.\delta_\text{sfc}\\
C_D &= C_{D0} + C_{Dk1}.C_L + C_{Dk2}.C_L^2 + \sum_{\text{sfc}} C_{D\text{sfc}}.\delta_\text{sfc} \\
C_Y &= C_{Y\alpha}(\alpha - \alpha_0) + C_{Y\beta}.\beta + \sum_{i=p,q,r} C_{Yi}.i + \sum_{\text{sfc}} C_{Y\text{sfc}}.\delta_\text{sfc}
\end{align}

\subsubsection{Aerodynamic moments in body frame}
\begin{equation}
  \vect{M}_{\text{aero}}^{B} = \frac{1}{2}.\rho.V^2.S_\text{ref}.\begin{pmatrix}B_\text{ref}.C_l\\C_\text{ref}.C_m\\B_\text{ref}.C_n\end{pmatrix}
\end{equation}
with
\begin{align}
C_l & = C_{l\alpha}(\alpha - \alpha_0) + C_{l\beta}.\beta + \sum_{i=p,q,r} C_{li}.i+ \sum_{\text{sfc}} C_{l\text{sfc}}.\delta_\text{sfc}\\
C_m & = C_{m\alpha}(\alpha - \alpha_0) + C_{m\beta}.\beta + \sum_{i=p,q,r} C_{mi}.i+ \sum_{\text{sfc}} C_{m\text{sfc}}.\delta_\text{sfc}\\
C_n & = C_{n\alpha}(\alpha - \alpha_0) + C_{n\beta}.\beta + \sum_{i=p,q,r} C_{ni}.i+ \sum_{\text{sfc}} C_{n\text{sfc}}.\delta_\text{sfc}
\end{align}

\subsection{Actuators}


\subsection{Summary}
\begin{equation}
R^{W \rightarrow B}
\end{equation}

\subsection{XML Parameters}
%\scriptsize
\lstinputlisting[basicstyle=\ttfamily\tiny,language=xml]{../config/Rcam.xml}

\subsection{Examples}
\lstinputlisting[basicstyle=\ttfamily\tiny,language=python]{../src/example_01_trim_jac.py}
\lstinputlisting[basicstyle=\ttfamily\tiny,language=python]{../src/example_02_open_loop.py}



